namespace JQuery.WebKit
{
    using System.ComponentModel;
    using System.Security.Permissions;
    using System.Web;
    using System.Web.UI;

    [TypeConverter(typeof(ExpandableObjectConverter)), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level=AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level=AspNetHostingPermissionLevel.Minimal)]
    public sealed class ToolBarSettings : IStateManager
    {
        private bool _isTracking;
        private StateBag _viewState = new StateBag();

        void IStateManager.LoadViewState(object state)
        {
            if (state != null)
            {
                ((IStateManager) this.ViewState).LoadViewState(state);
            }
        }

        object IStateManager.SaveViewState()
        {
            return ((IStateManager) this.ViewState).SaveViewState();
        }

        void IStateManager.TrackViewState()
        {
            this._isTracking = true;
            ((IStateManager) this.ViewState).TrackViewState();
        }

        public override string ToString()
        {
            return string.Empty;
        }

        [NotifyParentProperty(true), Description("Gets or sets the visibility of the edit button (plus) in the grid toolbar."), DefaultValue(false), Category("Appearance")]
        public bool ShowAddButton
        {
            get
            {
                object obj2 = this.ViewState["ShowAddButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowAddButton"] = value;
            }
        }

        [NotifyParentProperty(true), DefaultValue(false), Category("Appearance"), Description("Gets or sets the visibility of the delete button (recycle bin) in the grid toolbar.")]
        public bool ShowDeleteButton
        {
            get
            {
                object obj2 = this.ViewState["ShowDeleteButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowDeleteButton"] = value;
            }
        }

        [Category("Appearance"), Description("Gets or sets the visibility of the edit button (pencil) in the grid toolbar."), DefaultValue(false), NotifyParentProperty(true)]
        public bool ShowEditButton
        {
            get
            {
                object obj2 = this.ViewState["ShowEditButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowEditButton"] = value;
            }
        }

        [Description("Gets or sets the visibility of the search button (circle) in the grid toolbar."), NotifyParentProperty(true), DefaultValue(false), Category("Appearance")]
        public bool ShowRefreshButton
        {
            get
            {
                object obj2 = this.ViewState["ShowRefreshButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowRefreshButton"] = value;
            }
        }

        [NotifyParentProperty(true), DefaultValue(false), Category("Appearance"), Description("Gets or sets the visibility of the search button (magnifying glass) in the grid toolbar.")]
        public bool ShowSearchButton
        {
            get
            {
                object obj2 = this.ViewState["ShowSearchButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowSearchButton"] = value;
            }
        }

        [NotifyParentProperty(true), Category("Appearance"), Description("Determines if the grid search/filter toolbar should be shown on top of the grid."), DefaultValue(false)]
        public bool ShowSearchToolBar
        {
            get
            {
                object obj2 = this.ViewState["ShowSearchToolBar"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowSearchToolBar"] = value;
            }
        }

        [NotifyParentProperty(true), Category("Appearance"), Description("Gets or sets the visibility of the view row details button in the grid toolbar."), DefaultValue(false)]
        public bool ShowViewRowDetailsButton
        {
            get
            {
                object obj2 = this.ViewState["ShowViewRowDetailsButton"];
                if (obj2 == null)
                {
                    return false;
                }
                return (bool) obj2;
            }
            set
            {
                this.ViewState["ShowViewRowDetailsButton"] = value;
            }
        }

        bool IStateManager.IsTrackingViewState
        {
            get
            {
                return this._isTracking;
            }
        }

        [Category("Appearance"), Description("Alignment of the toolbar - left, center, right."), NotifyParentProperty(true), DefaultValue(0)]
        public JQuery.WebKit.ToolBarAlign ToolBarAlign
        {
            get
            {
                if (this.ViewState["ToolBarAlign"] != null)
                {
                    return (JQuery.WebKit.ToolBarAlign) this.ViewState["ToolBarAlign"];
                }
                return JQuery.WebKit.ToolBarAlign.Left;
            }
            set
            {
                this.ViewState["ToolBarAlign"] = value;
            }
        }

        [Description("Top, Bottom, TopAndBottom"), NotifyParentProperty(true), DefaultValue(1), Category("Appearance")]
        public JQuery.WebKit.ToolBarPosition ToolBarPosition
        {
            get
            {
                if (this.ViewState["ToolBarPosition"] != null)
                {
                    return (JQuery.WebKit.ToolBarPosition) this.ViewState["ToolBarPosition"];
                }
                return JQuery.WebKit.ToolBarPosition.Bottom;
            }
            set
            {
                this.ViewState["ToolBarPosition"] = value;
            }
        }

        private StateBag ViewState
        {
            get
            {
                return this._viewState;
            }
        }
    }
}

